/*
package com.com.itext.day1;




import com.itextpdf.kernel.geom.Rectangle;
import com.itextpdf.kernel.pdf.PdfWriter;
import com.itextpdf.layout.Document;
import javafx.scene.text.Font;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;

import static com.itextpdf.kernel.pdf.PdfName.BaseFont;

//自动创建pdf
public class demo1 {
    //表头
    public static final String[] tableHeader = {"姓名","性别","年龄"};
    //数据表字段数
    private  static final int colNumber = 3;
    //表格的设置
    private static final int spacing = 2;
    //表格的设置
    private static final int padding = 2;
    //创建pdf文档
    public static void createPDF() throws Exception {
        //创建pdf文档 50，50，50，50左右上下距离
        Document doc =  new Document(new Rectangle(1500,2000),50,50,50,50);
        PdfWriter.getInstance(doc,new FileOutputStream("d:\\学生信息.pdf"));
        //打开文档
        doc.open();
        //中文字体
        BaseFont bfChinesse = BaseFont.createFont("STSong-Light","UniGB-UCS2-H",BaseFont.NOT_EMBEDDED);
        Font font = new Font(bfChinesse,12,Font.NORMAL);
        //创建有colNumber列数的表格
        PdfPTable data = new PdfPTable(colNumber);
        //定义表格的宽度
        int[] cellsWidth = {3,3,3};
        data.setWidths(cellsWidth);
        //表格宽度百分比
        data.setWidthPercentage(80);
        data.getDefaultCell().setPadding(padding);
        data.getDefaultCell().setBorderWidth(spacing);
        //设置表格颜色
        data.getDefaultCell().setBackgroundColor(BaseColor.ORANGE);
        data.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
        //添加表头元素
        for(int i = 0; i<colNumber ;i++){
            data.addCell(new Paragraph(tableHeader[i],font));
        }
        String[] str = {"张","男","21"};
        //添加子元素
        for(int j = 0; j<=10;j++){
            for(int i = 0; i<colNumber ;i++){
                data.addCell(new Paragraph(str[i]+j,font));
            }
        }
        doc.add(data);
        doc.close();
    }

    public static void main(String[] args) throws Exception {
        createPDF();
    }
}
*/
